/* USER CODE BEGIN Header */
/**
  ******************************************************************************
  * @file    gpio.h
  * @brief   This file contains all the function prototypes for
  *          the gpio.c file
  ******************************************************************************
  * @attention
  *
  * Copyright (c) 2024 STMicroelectronics.
  * All rights reserved.
  *
  * This software is licensed under terms that can be found in the LICENSE file
  * in the root directory of this software component.
  * If no LICENSE file comes with this software, it is provided AS-IS.
  *
  ******************************************************************************
  */
/* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __GPIO_H__
#define __GPIO_H__

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "main.h"

/* USER CODE BEGIN Includes */

/* USER CODE END Includes */

/* USER CODE BEGIN Private defines */

extern char			g_uart_rxbuf[256];
extern uint8_t		g_uart1_bytes;

#define clear_uart1_rxch() do{memset(g_uart1_rxbuf,0,sizeof(g_uart1_rxbuf));\
								g_uart1_bytes=0;}while(0)
/* USER CODE END Private defines */

void MX_GPIO_Init(void);

/* USER CODE BEGIN Prototypes */

#define OFF 0
#define ON 1

enum
{
//	SysLed, /*想添加的led*/
	RedLed,
	GreenLed,
	BlueLed,
	LedMax,
};

enum
{
	Relay1,
	RelayMax,
};

typedef struct gpio_s
{
	GPIO_TypeDef	*group;
	uint16_t		pin;
}gpio_t;

extern gpio_t	relays[RelayMax];
extern gpio_t	leds[LedMax];


/*函数说明：控制LED亮�?�灭的功能函�????????
 * 参数说明：which 指定要控制哪个灯。取值为枚举类型的RedLed,BlueLed和GreenLed
 * status要控制灯还是�????????
 * 返回值：�????????
 */
extern void turn_led(int which, int status);

extern void turn_relay(int which, int status);

/*函数说明：控制Led闪烁的功能函�????????
 * 参数说明：which 指定要控制哪个灯。取值为枚举类型的RedLed,BlueLed和GreenLed
 * interval指定闪烁的间隔时间，其单位为毫秒
 * 返回值：�????????
 */
extern void blink_led(int which, uint32_t interval);

/*函数说明：心跳函数，让系统快速闪几下
 * 参数说明：无
 * 返回值：�????????
 */
extern void sysled_hearbeat(void);


//extern void HAL_GPIO_EXIT_Callback(uint16_t GPIO_Pin);


/* USER CODE END Prototypes */

#ifdef __cplusplus
}
#endif
#endif /*__ GPIO_H__ */

